/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mysweethome.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author BKC
 */
@Entity
@Table(name = "DetailContact", catalog = "MySweetHomeDB", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "DetailContact.findAll", query = "SELECT d FROM DetailContact d"),
    @NamedQuery(name = "DetailContact.findByPropertyInfoID", query = "SELECT d FROM DetailContact d WHERE d.propertyInfoID = :propertyInfoID"),
    @NamedQuery(name = "DetailContact.findByContactName", query = "SELECT d FROM DetailContact d WHERE d.contactName = :contactName"),
    @NamedQuery(name = "DetailContact.findByPhone", query = "SELECT d FROM DetailContact d WHERE d.phone = :phone"),
    @NamedQuery(name = "DetailContact.findByAddress", query = "SELECT d FROM DetailContact d WHERE d.address = :address"),
    @NamedQuery(name = "DetailContact.findByEmail", query = "SELECT d FROM DetailContact d WHERE d.email = :email")})
public class DetailContact implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "PropertyInfoID")
    private Integer propertyInfoID;
    @Basic(optional = false)
    @Column(name = "ContactName")
    private String contactName;
    @Basic(optional = false)
    @Column(name = "Phone")
    private String phone;
    @Column(name = "Address")
    private String address;
    @Column(name = "Email")
    private String email;
    @JoinColumn(name = "PropertyInfoID", referencedColumnName = "PropertyInfoID", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private GeneralInfo generalInfo;

    public DetailContact() {
    }

    public DetailContact(Integer propertyInfoID) {
        this.propertyInfoID = propertyInfoID;
    }

    public DetailContact(Integer propertyInfoID, String contactName, String phone) {
        this.propertyInfoID = propertyInfoID;
        this.contactName = contactName;
        this.phone = phone;
    }

    public Integer getPropertyInfoID() {
        return propertyInfoID;
    }

    public void setPropertyInfoID(Integer propertyInfoID) {
        this.propertyInfoID = propertyInfoID;
    }

    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public GeneralInfo getGeneralInfo() {
        return generalInfo;
    }

    public void setGeneralInfo(GeneralInfo generalInfo) {
        this.generalInfo = generalInfo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (propertyInfoID != null ? propertyInfoID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetailContact)) {
            return false;
        }
        DetailContact other = (DetailContact) object;
        if ((this.propertyInfoID == null && other.propertyInfoID != null) || (this.propertyInfoID != null && !this.propertyInfoID.equals(other.propertyInfoID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mysweethome.entities.DetailContact[propertyInfoID=" + propertyInfoID + "]";
    }

}
